import {createApp} from 'vue'
import ElementPlus from "element-plus";
import * as ElementPlusIcons from "@element-plus/icons-vue"; // 图标
import piniaPlugin from "pinia-plugin-persistedstate"; // 提供Pinia状态持久化功能
import "virtual:svg-icons-register";
// @ts-ignore
import {VueDraggableNext} from 'vue-draggable-next'
import SvgIcon from "@/components/SvgIcon/index.vue";
import "@/permission"

import "element-plus/theme-chalk/index.css";
import "element-plus/theme-chalk/dark/css-vars.css";
import "viewerjs/dist/viewer.css";
import "nprogress/nprogress.css";
import "@/assets/styles/index.scss";
import 'swiper/css';
import "swiper/css/autoplay";
import "swiper/css/mousewheel";
import "swiper/css/navigation";
import "swiper/css/pagination";
import Pagination from "@/components/Pagination/index.vue";

import App from './App.vue'
import router from "@/router";
import {createPinia} from "pinia";

const pinia = createPinia();
const app = createApp(App);

// 每个图标组件调用 app.component 方法注册为全局组件
for (const [key, component] of Object.entries(ElementPlusIcons)) {
    app.component(key, component);
}

// 注册库
pinia.use(piniaPlugin);
app.use(ElementPlus);
app.use(router);
app.use(pinia);
app.component("draggable", VueDraggableNext);
app.component("svg-icon", SvgIcon);
app.component("Pagination", Pagination);
app.mount("#app");
